{include file="public/header"/}
</head>
<body>
<div class="layui-form" id="LAY-component-layer-list">
    <div class="layui-fluid pd83">
        <div class="layui-card pcf30">
          <input type="hidden" name="id" value="{$info.id}">
          <div class="layui-form-item">
            <label class="layui-form-label"><b class="pcfts">*</b> 广告名称</label>
            <div class="layui-input-inline pcfcms_layui-input-inline">
             <input type="text" name="title" id="title" value="{$info.title}" class="layui-input" lay-verType="tips" lay-verify="required" required>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">广告描述</label>
            <div class="layui-input-inline pcfcms_layui-input-inline">
                <textarea name="content" class="layui-textarea">{$info.content}</textarea>
            </div>
          </div>
          <div class="pcfclear"></div>
        </div>
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function(){
        var $ = layui.$,
            layer = layui.layer,
            form = layui.form;
            form.render();

            //监听提交
            form.on('submit(formSubmit)', function(data){
                layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
                $.ajax({
                    type : 'post',
                    url : "{:url('/adposition/edit')}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll('loading');
                        if(res.status){
                            layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                                parent.window.location.href = res.url;
                            });
                        }else{
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    },
                    error: function(e){
                        layer.closeAll('loading');
                        layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                    }
                });
            });

    });
</script>